
<template>
  <div id="feedback">
    <div v-show="!isSuccess" class="top">
      <input v-model="title" type="text" placeholder="请在此输入您的反馈标题">
      <textarea v-model="text" name="" id="" cols="30" rows="10" placeholder="请在此输入您的反馈意见"></textarea>
    </div>
    <a v-show="!isSuccess" href="javascript:;" @click='push'>发表</a>
    <div class="hide" v-show="isSuccess">
      <img src="../../../wechat/static/images/cg.png" alt=""> 发表成功
    </div>
  </div>
</template>

<script>
export default {
  name: "feedback",
  data() {
    return {
      title: "",
      text: "",
      isSuccess: false
    };
  },
  mounted() {},
  created() {},
  methods: {
    push() {
      if (!this.title || !this.text) {
        this.$vux.toast.show({
          text: "所填信息不能为空",
          type: "warn",
              width: 'auto'
        });
        return;
      }
      let url =
        this.$CONSTANT.MY.saveEsAdvice +
        "?sessionId=" +
        this.$common.getCookie("sessionId");
      let param = {
        detail: this.text,
        title: this.title,
        userId: localStorage.getItem("userId")||''
      };
      this.$vux.loading.show({
        text: "正在提交反馈意见"
      });
      setTimeout(() => {
        this.$common.post(url, param, res => {
          this.$vux.loading.hide();
          if (res.status == 200) {
            var bussData = res.data.bussData;
            this.$vux.toast.show({
              text: res.msg,
              type: "",
              width: 'auto'
            });
            setTimeout(() => {
              this.isSuccess = true;
            }, 1000);
          } else {
            this.$vux.toast.show({
              text: res.msg,
              type: "warn",
              width: 'auto'
            });
          }
        });
      }, 1000);
    }
  },
  components: {}
};
</script>

<style lang="less">
#feedback {
  height: 100%;
  background: #fff;
  .top {
    margin: 0 15px;
    input {
      width: 100%;
      // height: 53px;
      // line-height: 53px;
      padding: 20px 0;
      border-bottom: 1px solid #e1e1e1;
      font-family: PingFang-SC-Bold;font-weight: 600;
      font-size: 15px;
      color: #333;
    }
    input::-webkit-input-placeholder {
      color: #bdbdbd;
    }
    textarea::-webkit-input-placeholder {
      color: #bdbdbd;
    }
    textarea {
      width: 100%;
      margin-top: 20px;
      background: #f6f7f9;
      font-family: PingFang-SC-Medium;
      font-size: 14px;
      color: #333;
      resize: none;
      padding: 15px 12px;
      border: none;
      box-sizing: border-box;
    }
  }
  a {
    position: fixed;
    bottom: 41px;
    left: 19.5%;
    text-align: center;
    display: inline-block;
    width: 61.6%;
    height: 45px;
    line-height: 45px;
    border: 1px solid transparent;
    border-radius: 23px;
    background-color: #f02931;
    font-family: PingFang-SC-Bold;font-weight: 600;
    font-size: 15px;
    color: #fff;
    text-align: center;
    &:hover {
      background-color: #e1252c;
    }
  }
  .hide {
    text-align: center;
    padding-top: 119px;
    font-family: PingFang-SC-Medium;
    font-size: 19px;
    color: #333;
    img {
      display: block;
      margin: 0 auto;
      margin-bottom: 13px;
      width: 69px;
      height: 69px;
    }
  }
}
</style>
